#include "CNetwork.h"

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

int main()
{
	srand((unsigned int)time(NULL));

	std::vector< CNetwork > Networks;
	//Initialize the network. Arguments:
	//	Network ID
	//  Number of physical nodes
	//    How many are regular nodes
	//    How many are super nodes
	//  Number of files to create
	//  (Maximum x value for physical grid)
	//  (Maximum y value for physical grid)
	CNetwork NetworkA (0, 100, 10, 30, 50); 

	std::cout << "Back to start" << std::endl;
	Networks.push_back(NetworkA);

	//Each network will print out results after calling End(). 
	//   The output file will be Network(ID#).txt.

	bool keepgoing = true;
	double time = 0.;
	int maxTime = 30;
	while (time < maxTime)
	{
		for (int i=0; i<(int)Networks.size(); i++)
		{
			Networks[i].Update(time); //TODO: need to update with current time?
			//Or does each node do as much as possible in the current time step,
			//  and must take several time steps to complete certain jobs...
		}
		time++;
	}
	
	
	//Finish, clean up
	for (int i=0; i<(int)Networks.size(); i++)
	{
		Networks[i].End();
	}



	return 0;
}